<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>

<html lang="en">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=9">
        <link rel="stylesheet" href="<%=basePath %>client/css/cssreset.css">
        <link rel="stylesheet" href="<%=basePath %>client/css/style.css">
        <link rel="stylesheet" href="<%=basePath %>client/css/style2.css">
        <link rel="stylesheet" href="<%=basePath%>css/mycss.css">
        <link rel="stylesheet" href="<%=basePath%>css/mystyle.css"> 
        <script src="<%=basePath %>client/js/jquery-1.11.1.min.js"></script>
        <style type="text/css">
		   	#pageaaa a{
			        width: 23px;
			        height: 23px;
			        border: 1px solid #dce0e0;
			        text-align: center;
			        margin: 0 4px;
			        cursor: pointer;
			        display: inline-block;
			        font-size: 17px;
			    }
			    .current{
			        background-color: #5ac3e7;
			    }
			     .bianji1{
				width: 552px;
				height: 369px;
				border:1px solid #ccc;
				border-radius:5px;
				position:absolute;
				top:110px;
				left:50%;
				margin-left:-260px;
				background:#fff;
				display:none;
				z-index:1;
			}
			.bianji1>p{
				width:100%;
				line-height:42px;
				text-indent:2em;
				color:#818181;
				border-bottom:1px solid #dddddd;
			}
			.bianji1>p>img{
				cursor:pointer;
				position:relative;
				left:426px;
			}
			.bianji1>form>p{
				text-align:center;
				margin-bottom:21px;
				color:#555555;
				overflow:hidden;
			}
			.bianji1>form>p>span:nth-of-type(2){
				color:red;
				margin-left:10px;
			}
			
			.bianji1>form>p:nth-of-type(1){
				margin-top:19px;
				
			}
			.bianji1>form>p>input{
				float:none;
				width:300px;
				height:28px;
				text-align:left;
				margin-left:50px;
				outline:none;
				border:1px solid #ccc;
				border-radius:5px;
			}
			
			.bianji1>form>p:nth-of-type(7){
				width:100%;
				height:32px;
				background:#dfe4ea;
				padding:10px 0;
			}
			.bianji1>form>p:nth-of-type(7)>input{
				width: 56px;
				line-height: 28px;
				background:#57c049;
				border:none;
				border-radius:5px;
				color:#fff;
				position:relative;
				left:160px;
				cursor:pointer;
				text-align:center;
			}
			.bianji1>form>p:nth-of-type(7)>input:nth-of-type(1){
				left:190px;
				background:#ccc;
			}
			.smallsa{
				width:100%;
				height:1062px;
				position:absolute;
				top:0px;
				left:0px;
				background:rgba(0,0,0,0.2);
				display:none;
			}
		  </style>
         <script>
        	
            $(function(){
            	$(".light3").click(function(e){
			    		$('body').css("overflow","hidden")
			        e.preventDefault();
			        $("#cover4").css("display","block");
			        $("#cover4").animate({
			            width: "100%",
			            height: "1800px",
			            top: "0",
			            left: "0"
			        },10);
			        
			    });
			    $(".close").click(function(){
			        $("#cover4").removeAttr("style");
			        $("#cover-content3").removeAttr("style");
			    });
                $('.sh1').mouseover(function(event) {
                    $('.showhide1').css('display', 'block');
                });
                $('.sh1').mouseout(function(event) {
                    $('.showhide1').css('display', 'none');
                });
                $('.sh2').mouseover(function(event) {
                    $('.showhide2').css('display', 'block');
                });
                $('.sh2').mouseout(function(event) {
                    $('.showhide2').css('display', 'none');
                });
                $('.sh3').mouseover(function(event) {
                    $('.showhide3').css('display', 'block');
                });
                $('.sh3').mouseout(function(event) {
                    $('.showhide3').css('display', 'none');
                });
                $('.sh4').mouseover(function(event) {
                    $('.showhide4').css('display', 'block');
                });
                $('.sh4').mouseout(function(event) {
                    $('.showhide4').css('display', 'none');
                });
                
            })
        </script> 
        <script>
		  	function selectCheck(){
	    	   var judge = $("#selectCheck").val();
	    	   var objs = document.getElementsByName("items");
			   if(judge == 1){
				   for(var i = 0,l = objs.length;i < l;i++){
		    		   objs[i].checked = true;
		    	   }
				   $("#selectCheck").val(0);
	    	   }else{
	    		   for(var i = 0,l = objs.length;i < l;i++){
		    		   objs[i].checked = false;
		    	   }
	    		   $("#selectCheck").val(1);
	    	   }
	    	   
	    	   checkedShow();
	       }
		  	
		  	function checkedShow(){
		  		var str = "";
	    	    var number = 0;
	    	    var obj = document.getElementsByName("items");
				for(var i = 0,l = obj.length;i < l;i++){
					if(obj[i].checked){
						str += obj[i].value+",";
						number++;
					}
				}    	   
	    			
	    	    if(str == ""){
	    		   $(".yezi1").hide();
	    		   $('.smalltitle p').css('display', 'block');
	    		   $('.light3').css('display', 'inline-block');
	    		   $('.yezi3').css('display', 'inline-block');
	    	    }else{
	    	       //$('.smalltitle p').css('display', 'none');
	    		   $(".staff_id").html(str);
	    		   $(".yezi1").show();
	    		   $("#number").html(number);
	    		   $('.light3').css('display', 'none');
	    		   $('.yezi3').css('display', 'none');
	    		   $('.checkok').css('display', 'block');
	    		   $('.del').css('display', 'block');
	    		   $('.shift').css('display', 'block');
	    		   $('.close2').css('display', 'block');
	    		   
	    		   $('.yezi1 .shanchu').css('display', 'block');
	    		   $('.yezi1 .bianji').css('display', 'block');
	    	   }
		  	}
		  	$(function(){
		  		$('.close2').click(function(event) {
		  			$(".yezi1").hide();
		  			$(".yezi").show();
		  			$('.light3').css('display', 'inline-block');
	    		   $('.yezi3').css('display', 'inline-block');
		  		});
		  	})
		  	function textas(){
		    	var shoujihao=$("#shoujihao").val();
		    	var mima=$("#mimatian").val();
		    	var newpass=$(".newpass").val();
		    	var newspass=$(".newspass").val();
		    	var p=/\s/;
		    	var mimajiu=$("#mimajiu").val();
		    	if(shoujihao==""||p.test(shoujihao)){
		    		alert("请填写手机号！");
		    		return false;
		    	}else if(mima!=mimajiu){
		    		alert("输入的密码不一致！");
		    		return false;
		    	}else if(newpass==mima){
		    		alert("输入的密码不能与旧密码一致！");
		    		return false;
		    	}else if(newpass==""||p.test(newpass)){
		    		alert("请输入新密码！");
		    		return false;
		    	}else if(newspass==""||p.test(newspass)){
		    		alert("请再次输入新密码！");
		    		return false;
		    	}else if(newspass!=newpass){
		    		alert("与重新设置的密码不相同，请重新输入！");
		    		return false;
		    	}
		    	return true;
		    }
		  </script>
    </head>
    <body>
    	<div class="bigbox">
    		<nav class="daohan">
                <ul>
                	<li class="sh1">
                        <a href="<%=basePath %>notice/findByAll.action"><p class="mline"><span class="smallicon" id="current1"></span><span class="navtxt">首页</span></p></a>  
                    </li>
                    <li>
                        <a href="<%=basePath %>client/qiangenzongcount.action?zhuizong=0"  ><p class="mline"><span class="smallicon" id="current11"></span><span class="navtxt"  >用户开发</span></p></a>
                    </li>
                    <li>
                        <a href="<%=basePath %>client/selectDepOrSta.action?start=1">
                            <p class="mline">
                                <span class="smallicon" id="ziji11"></span>
                                <span class="navtxt">代理开发</span>
                            </p>
                        </a>
                    </li>
                    <li class="sh2">
                        <a href="<%=basePath %>client/selectByStaffAnd.action?start=1" id="sline"><p class="mline"><span class="smallicon one111"></span><span class="navtxt" id="current2">客户资料</span><span class="ripic"></span></p></a>
                        <div class="showhide2">
                            <a href="<%=basePath %>client/selectByStaffAnd.action" id="sline" style="font-size:14px;background:#435565;">
                             <p class="mline mline2">
                                <span class="smallicon" id="ziji3"></span>
                                <span class="navtxt" style="font-size:14px;">用户资料</span>
                             </p>
                             </a> 

                             <a href="<%=basePath %>client/selectByStaffAnd.action?start=1" id="sline"  style="font-size:14px;margin-top:-22px;">
                             <p class="mline mline2">
                                <span class="smallicon" id="ziji333"></span>
                                <span class="navtxt" id="current2" style="font-size: 14px;">代理资料</span>
                             </p>
                             </a>    
                        </div>
                    </li>
                    <li>
                        <a href="<%=basePath %>approve/count.action?pageSize=0"><p class="mline"><span class="smallicon one2"></span><span class="navtxt">合同审批</span></p></a> 
                    </li>
                    <li>
                         <a href="<%=basePath%>page/pacts.jsp">
                             <p class="mline"><span class="smallicon one222"></span><span class="navtxt">审批详情</span></p>
                         </a>
                        
                    </li>
                    
                     <li>
                        <a href="<%=basePath %>Operate/count.action">
                             <p class="mline"><span class="smallicon" id="yunyin2"></span><span class="navtxt">运营管理</span></p>
                         </a>
                    </li>  
                    
                   <li>
                        <a href="#"><p class="mline"><span class="smallicon one3"></span><span class="navtxt">产品资源库</span></p></a>
                    </li>
                    <c:if test="${backstage == 1}">
                    	<li>
	                        <a href="<%=basePath %>client/findByAllGr.action"><p class="mline"><span class="smallicon one333"></span><span class="navtxt">后台管理</span></p></a>
	                    </li>
                    </c:if>
                </ul>
            </nav>
            
    		<div class="showbox">
                <h2>代 理 资 料
                	<span class="exit">
						<span class="ex1">姓名:${staff.staff_name}</span>
						<a href="../login/tuichustaff.action" class="ex2"><span class="exicon2"></span>切换账号</a>
						<a href="../login/tuichustaff.action" class="ex3"><span class="exicon3"></span>退出账号</a>
					</span>
                </h2>
                <div class="showbox2">
	    		
	    			<div class="aaa">
		    			<div class="smalltitle">
		 					
							
							<span class="yezi3">
		 						<form action="<%=basePath %>client/selectByAllData.action?classfiy=1" method="post" onsubmit="selectBy()">
									<input value="${select}" type="text" name="select" placeholder="公司负责人" style="color:#bfbfbf;font-size:12px;border-radius: 16px;outline:none;border:1px solid #e7e7e8;height:36px;width:200px">
		 							<input type="submit"  value="搜 索" style="height:36px;width:70px;border-radius: 16px;outline:none;border:none;background:#1fd4fb;color:#fff;margin-left:10px;">
								</form>	
		 					</span>
		 					<p class="yezi">
								<!-- <a href="#"><span class="imgmove imgmove2"><img src="../images/daoru.png" alt=""></span>&nbsp;&nbsp;导入</a>
								<a href="#"><span class="imgmove"><img src="../images/daochu.png" alt=""></span>&nbsp;&nbsp;导出</a> -->
							 </p>
							 <!-- <span class="yezi1">
								 
								 <h4 class="checkok">已选择 <span style="color:#1fd4fb;" id="number"> </span> 项</h4>
				    				<span class="close2">
				    					<img src="../images/guanbi.png" alt="">
				    				</span>
			    			 </span>  -->
		    			</div>
	    				
	    				<div class="tab">
	    					<p class="tline">
	    						<span class="cname">编码</span>
			    		        <span>客户姓名</span>
			    		        <span style="width:150px;">电话</span>
			    		        <span style="width:130px;">来源渠道</span>
			    		        <span style="width:405px;">追踪情况</span>
	    					</p>
	    					
	    					<c:forEach items="${clients}" var="client" varStatus="index">
		    					<c:choose>
		    					 		<c:when test="${index.index % 2 == 0 }">
		    						<p class="tline tline2" style="background:#fff;">
				    		            <span class="cname" ><a style="text-decoration:none;color:#8c8c8d;font-size:14px;" href="../client/newrecord.action?id=${client.client_id}">${client.client_id}</a></span>
					    		        <span>${client.client_name}</span>
				    		            
				    		            <c:choose>
				    		            	<c:when test="${backstage == 1}">
				    		            		<span style="width:150px;">${client.client_phone}</span>
				    		            	</c:when>
				    		            	<c:when test="${client.client_staffId == 0}">
				    		            		<span style="width:150px;">${client.client_phone}</span>
				    		            	</c:when>
				    		            	<c:when test="${client.client_departmentId == 0}">
				    		            		<c:if test="${client.client_staffId == sessionScope.staff.staff_id}">
				    		            			<span style="width:150px;">${client.client_phone}</span>
				    		            		</c:if>
				    		            		<c:if test="${client.client_staffId != sessionScope.staff.staff_id}">
				    		            			<span style="width:150px;">无权查看</span>
				    		            		</c:if>
				    		            	</c:when>
				    		            	<c:otherwise>
			    		            			<span>无权查看</span>
				    		            	</c:otherwise>
				    		            </c:choose>
				    		            <span style="width:130px;">${client.client_record}</span>
				    		            <span style="width:405px;padding-left:5px;">&nbsp;&nbsp;&nbsp;&nbsp;${client.client_remarks}</span>
				    		            
			    					</p>
			    					</c:when>
	    					 		<c:otherwise>
	    					 			<p class="tline tline2">
					    		            <span class="cname" ><a style="text-decoration:none;color:#8c8c8d;font-size:14px;" href="../client/newrecord.action?id=${client.client_id}">${client.client_id}</a></span>
					    		            <span>${client.client_name}</span>
					    		            
					    		            <c:choose>
					    		            	<c:when test="${backstage == 1}">
					    		            		<span style="width:150px;">${client.client_phone}</span>
					    		            	</c:when>
					    		            	<c:when test="${client.client_staffId == 0}">
					    		            		<span style="width:150px;">${client.client_phone}</span>
					    		            	</c:when>
					    		            	<c:when test="${client.client_departmentId == 0}">
					    		            		<c:if test="${client.client_staffId == sessionScope.staff.staff_id}">
					    		            			<span style="width:150px;">${client.client_phone}</span>
					    		            		</c:if>
					    		            		<c:if test="${client.client_staffId != sessionScope.staff.staff_id}">
					    		            			<span style="width:150px;">无权查看</span>
					    		            		</c:if>
					    		            	</c:when>
					    		            	<c:otherwise>
					    		            			<span>无权查看</span>
					    		            	</c:otherwise>
					    		            </c:choose>
					    		            <span style="width:130px;">${client.client_record}</span>
					    		            <span style="width:405px;padding-left:5px;">&nbsp;&nbsp;&nbsp;&nbsp;${client.client_remarks}</span>
				    					</p>
	    					 		</c:otherwise>
    					 		</c:choose>
	    					</c:forEach>
	    				</div>
	    				<div id="pageaaa" style="text-align:right;margin-top:100px;width:98%;"></div>
	    				<div id="cover4">
					 </div>
	    		</div>
	    	</div>
            </div>
            <div style="display: none">
            	
	        	<span class="pageCount">${pageCount}</span>
	        	<span class="pageNum">${pageNum}</span>
	    	</div>
	    	
	    	 <div class="bianji1">
	    		<p>信息修改<img src="../images/guanbi.png" alt="" class="gb"></p>
	    		<form action="javascript:updateguanli()" method="post" onsubmit="return textas()">
	    			<input type="hidden" disabled="disabled" id="staffId" value="${staff.staff_id}">
	    			<p><span style="margin-right:43px;">姓 名</span><input type="text" disabled="disabled" id="xingming" value="${staff.staff_name}"></p>
	    			<p><span style="margin-right:28px;">手 机 号</span><input type="text" id="shoujihao" value="${staff.staff_phone}"><span>*</span></p>
	    			<p><span style="margin-right:28px;">旧 密 码</span><input type="hidden" id="mimajiu" value="${staff.staff_password}"><input type="text" name="password" id="mimatian" value=""><span>*</span></p>
	    			<p><span style="margin-right:28px;">新 密 码</span><input type="password" name="password" class="newpass" id="mima" value=""><span>*</span></p>
	    			<p><span style="margin-right:10px;">确 认密 码</span><input type="password" name="password" class="newspass" id="" value=""><span>*</span></p>
	    			<p><span style="margin-right:19px;">邮 箱 号</span><input type="text" id="youxiang" value="${staff.staff_email}"><span>*</span></p>
	    			<p><input type="button" value="取消" class="qi"><input type="submit" value="确定"></p>
	    		</form>
	    	</div>
    		<div class="smallsa"></div>
    </body>
    <script src="../client/js/paging.js"></script>
    <script type="text/javascript">
    function updateguanli(){
    	var url="${pageContext.request.contextPath}/staff/qianupdate.action";
		var pam={
				staff_id:$("#staffId").val(),
				staff_password:$("#mima").val(),
				staff_phone:$("#shoujihao").val(),
				staff_userName:$("#xingming").val(),
				staff_email:$("#youxiang").val()	
				};
		
		$.post(url,pam,function(data){		
				location="${pageContext.request.contextPath}/client/selectByStaffAnd.action?start=1";
	});
    }
    
    $('.ex1').click(function(){
    	$('.bianji1').css('display','block');
    	$('.smallsa').css('display','block');
    })
    $('.gb').click(function(){
    	$('.bianji1').css('display','none');
    	$('.smallsa').css('display','none');
    })
     $('.qi').click(function(){
    	$('.bianji1').css('display','none');
    	$('.smallsa').css('display','none');
    })
    
    
	    $(function(){
	    	var pageCount = $(".pageCount").html();
	    	var pageNum = $(".pageNum").html();
	    	pageNum = parseInt(pageNum);
	    	pageCount = parseInt(pageCount);
	        $('#pageaaa').paging({pageNo:pageCount,totalPage:pageNum,callback:function(cur){
	            console.log(cur);
	        }});
	    });
    </script>
    <script>
         $(function(){  
        	 
        	  //判断浏览器是否支持placeholder属性
        	  supportPlaceholder='placeholder'in document.createElement('input'),
        	 
        	  placeholder=function(input){
        	 
        	    var text = input.attr('placeholder'),
        	    defaultValue = input.defaultValue;
        	 
        	    if(!defaultValue){
        	 
        	      input.val(text).addClass("phcolor");
        	    }
        	 
        	    input.focus(function(){
        	 
        	      if(input.val() == text){
        	   
        	        $(this).val("");
        	      }
        	    });
        	 
        	  
        	    input.blur(function(){
        	 
        	      if(input.val() == ""){
        	       
        	        $(this).val(text).addClass("phcolor");
        	      }
        	    });
        	 
        	    //输入的字符不为灰色
        	    input.keydown(function(){
        	  
        	      $(this).removeClass("phcolor");
        	    });
        	  };
        	 
        	  //当浏览器不支持placeholder属性时，调用placeholder函数
        	  if(!supportPlaceholder){
        	 
        	    $('input').each(function(){
        	 
        	      text = $(this).attr("placeholder");
        	 
        	      if($(this).attr("type") == "text"){
        	 
        	        placeholder($(this));
        	      }
        	    });
        	  }
        	 
        	});
         </script>
</html>
